package com.example.springbook.mapper;

import com.example.springbook.model.BookInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookMapper {
    @Insert("insert into book_info (book_name,author,count,price,publish) values (#{bookName},#{author},#{count},#{price},#{publish})")
    Integer insert(BookInfo bookInfo);
    @Select("select * from book_info where status=1 limit #{offset},#{limit} ")
    List<BookInfo>  queryBookByPage(Integer offset,Integer limit);
    @Select("select count(1) from book_info")
    Integer count();
    @Select("select * from book_info where id=#{id}  ")
    BookInfo queryBookById(Integer id);

    Integer updateBook(BookInfo bookInfo);
    Integer batchDeleteBookByIds(List<Integer> ids);

}
